//
//  DFNetworkTool.swift
//  FlyBlog
//
//  Created by FEI on 16/4/11.
//  Copyright © 2016年 FEI. All rights reserved.
//

import UIKit
import AFNetworking

enum DFNetworkErrorEnum: Int {
     case AccessTokenEmpty = -1
     case UidEmpty = -2
    case RepeatLoadStatus = -3

    var errorDescription: String {
        get {
            switch self {
            case AccessTokenEmpty: return "access_token没有值"
            case UidEmpty : return "uid没有值"
            case .RepeatLoadStatus: return "有人在加载微博数据"
            }
        }
    }

    func error() -> NSError {
        return NSError(domain: "www.baidu.com", code: self.rawValue, userInfo: ["errorDescription" : self.errorDescription])
    }
}



class DFNetworkTool: AFHTTPSessionManager {
    //单例
    static let shareInstance: DFNetworkTool = {
        let tool = DFNetworkTool()

    tool.responseSerializer.acceptableContentTypes?.insert("text/plain")

    return tool
    }()
}
